Redact sensitive duplicate query parameter values in ApiServlet logs#13677
Redact sensitive duplicate query parameter values in ApiServlet logs#13677dheeraj12347 wants to merge 1 commit into
Conversation
|
As discussed in #13559, this is the manual backport of the fix for the 4.20 LTS branch. |
DaanHoogland
left a comment
There was a problem hiding this comment.
some linting but clgtm still
| private static final String REDACTED = "REDACTED"; | ||
| private static final String LOGGER_REPLACEMENTS = "[\n\r\t]"; | ||
|
|
||
| private static final Set<String> SENSITIVE_PARAMETER_KEYWORDS = Set.of( | ||
| "password", | ||
| "privatekey", | ||
| "accesskey", | ||
| "secretkey", | ||
| "apikey", | ||
| "signature", | ||
| "sessionkey", | ||
| "token" | ||
| ); |
| } | ||
|
|
||
| static String formatValuesForLog(String parameterName, String[] values) { | ||
| if (!isSensitiveParameter(parameterName)) { | ||
| return Arrays.toString(values); | ||
| } | ||
|
|
||
| String[] masked = new String[values.length]; | ||
| Arrays.fill(masked, REDACTED); | ||
| return Arrays.toString(masked); | ||
| } |
There was a problem hiding this comment.
indent is off for this bit as well
|
@dheeraj12347 , you should not have to open a new PR (next time) just rebase your fix with I think we can close the one on main now and it looks like it won’t give major conflicts when merging forwards. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #13677 +/- ##
=========================================
Coverage 16.26% 16.26%
- Complexity 13435 13438 +3
=========================================
Files 5667 5667
Lines 500731 500746 +15
Branches 60803 60803
=========================================
+ Hits 81430 81466 +36
+ Misses 410197 410171 -26
- Partials 9104 9109 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
This PR manually backports the fix from #13559 to the 4.20 LTS branch.
Changes
ApiServlet.This backport includes the changes applicable to the 4.20 branch.
Fixes #13311